Skip to content

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Feb 19, 2025

  • Add zizmor to pre-commit and fix warnings
  • Update pre-commit and apply Ruff changes

Comment on lines +5 to +6
permissions: {}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this added just to explicitly state that no extra permissions are granted (I would assume that's already the default)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this added just to explicitly state that no extra permissions are granted

Yes.

(I would assume that's already the default)?

No, see below.


Furthermore, users often don't realize that the default GITHUB_TOKEN permissions can be very broad, meaning that workflows that don't configure any permissions at all can still provide excessive credentials to their individual jobs.

...

In practice, this means that workflows should almost always set permissions: {} at the workflow level to disable all permissions by default, and then set specific job-level permissions as needed.

https://woodruffw.github.io/zizmor/audits/#excessive-permissions

The default access (permissive) is read/write for most of the scopes:

https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation, this is good to know!

So the default permissions are too permissive, the contents: read that was explicitly set before was still not needed, and the permissions: {} we have now disables all permissions.

@AA-Turner AA-Turner merged commit 6902d1c into python:main Feb 20, 2025
5 checks passed
@hugovk hugovk deleted the update-pre-commit branch February 20, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants